my-image:
    FROM alpine
    SAVE IMAGE my/image:test

MY_COMMAND_WITH_DOCKER:
    COMMAND
    ARG MY_ARG="default"
    WITH DOCKER --load +my-image
        RUN echo "got $MY_ARG"
    END

test:
    FROM earthly/dind:alpine
    DO +MY_COMMAND_WITH_DOCKER --MY_ARG="myvalue"
    DO +MY_COMMAND_WITH_DOCKER
